<?php
//实例化memcache
$obj = new Memcache();
//设置数据库连接地址、端口号
$obj->connect("localhost",11211);
//查询数据
$sql ="select * from ddd ";
//运行sql语句
$res = $this->exec($sql);
//把数据保存到memcache
$obj->set("data","$res");
//把memcache中的数据取出来
$data = $obj->get("data");

?>